<?php
/*
 * @Author: lokei
 * @Date: 2022-10-06 10:12:08
 * @LastEditors: lokei
 * @LastEditTime: 2022-10-06 10:23:06
 * @Description: 
 */
namespace App\Http\Controllers\Store\Conf;

use App\Common\Tools\ResultTool;
use App\Http\Controllers\Controller;
use App\Models\Store\ConfModel;
use Illuminate\Http\Request;

class ConfController extends Controller {
    public function get() {
        $conf = ConfModel::first();
        if(is_null($conf)) {
            $conf = new ConfModel();
            $conf->agreement_content = '商家入驻协议！';
            $conf->save();
            $conf = ConfModel::first();
        }
        $res = ResultTool::success();
        $res['data'] = $conf;
        return $res;
    }

    public function update(Request $request) {
        $conf = ConfModel::first();
        $conf->agreement_content = $request->input('agreement_content');
        $conf->save();
        return ResultTool::success();
    }
}